<!-- 这是什么页面 -->
<template>
	<view class="content">
		<view class="search-box">
			<view class="search-box">
				<view class="search-left-box">
					<uni-search-bar @confirm="search" v-model="searchValue" @cancel="cancel" @clear="clear"
						placeholder="请输入订单编号">
					</uni-search-bar>
				</view>
				<view class="search-right-box">
					<uni-search-bar @confirm="search" v-model="searchValue1" @cancel="cancel1" @clear="clear1"
						placeholder="输入产品型号">
					</uni-search-bar>
				</view>
			</view>
		</view>
		<z-paging ref="paging" v-model="dataList" :default-page-size="row" @onRefresh="onRefresh" @query="getList"
			auto-show-system-loading auto-show-back-to-top>
			<view class="" style="margin-top: 110rpx;"></view>
			<view class="list-box" @click="goto(item.id)" v-for="(item,index) in dataList" :key="index">
				<view class="top-box">
					<view class="tiem-box" v-if="item.lvdoNo">
						请购单号：{{item.lvdoNo}}
					</view>
					<view class="status-box">
					<view class="item-box">
						{{$tools.dictDispose(goods_status,item.status)}}
					</view>
				</view>
				</view>
				<view class="xian"></view>
				<view class="title-box" v-if="item.order.projectCode">
					框架编号：{{item.order.projectCode}}
				</view>
				<view class="title-box" v-if="item.projectNo">
					订单编号：{{item.projectNo}}
				</view>
				<view class="title-box" v-if="item.goodsCode">
					产品编码：{{item.goodsCode}}
				</view>
				<view class="info-box">
					<view class="info-item" v-if="item.goodsName">
						<view class="info-item-title">
							产品名称
						</view>
						<view class="info-item-text">
							{{item.goodsName}}
						</view>
					</view>
					<view class="info-item" v-if="item.model">
						<view class="info-item-title">
							产品型号
						</view>
						<view class="info-item-text">
							{{item.model}}
						</view>
					</view>
					<view class="info-item" v-if="item.orderCount">
						<view class="info-item-title">
							订单数量
						</view>
						<view class="info-item-text">
							{{item.orderCount}}
						</view>
					</view>
					<view class="info-item" v-if="item.goodsUnitPrice && checkPermi(['develop:marketPrice:look'])">
						<view class="info-item-title">
							销售单价
						</view>
						<view class="info-item-text">
							{{item.goodsUnitPrice}}
						</view>
					</view>
				</view>
				<view class="text-box" v-if="item.lockCount">
					锁定数量：{{item.lockCount}}
				</view>
				<view class="text-box" v-if="item.isdo">
					是否自制：{{$tools.dictDispose(isdo,item.isdo)}}
				</view>
				<view class="text-box" v-if="item.pleaseBuyCount">
					自制/请购数量：{{item.pleaseBuyCount}}
				</view>
				<view class="text-box" v-if="item.createTime">
					创建日期：{{item.createTime}}
				</view>
				<view class="text-box" v-if="item.gongchengName">
					工程名称：{{item.gongchengName}}
				</view>
				<view class="text-box" v-if="item.state">
					工序分配状态：{{$tools.dictDispose(sale_state,item.state)}}
				</view>
				<view class="text-box" v-if="item.order.createName">
					制单人：{{item.order.createName}}
				</view>
				<view class="text-box" v-if="item.order.salesmanName">
					业务员：{{item.order.salesmanName}}
				</view>
				<view class="text-box" v-if="item.remark">
					备注信息：{{item.remark}}
				</view>
				<!-- <view class="xian"></view>
				<view class="bnt-box">
					<view class="bnt-big-box">
						<view class="bnt" @click.stop="goto(item.id)">
							订单产品
						</view>
					</view>
				</view> -->
			</view>
		</z-paging>
	</view>
</template>

<script>
	import OrdrList from '@/components/ordrList/index.vue'
	import * as index from '@/api/index.js'
	export default {
		components: {
			OrdrList
		},
		data() {
			return {
				row: 10, // 一页10条数据
				searchValue: '', // 搜索绑定值
				searchValue1: '', // 第二个搜索绑定值
				dataList: [], // 列表数据
				goods_status: [], // 产品状态
				sale_state: [], // 工序分配状态
				project_source: [], //项目来源
				order_goods_type:[], //订单类型
			}
		},
		onLoad() {
			this.dictType() // 数据字典查询

		},
		onShow() {

		},
		methods: {
			dictType() {
				index.typesBatch({
					'goods_status' : 'goods_status',
					'sale_state' : 'sale_state',
					'isdo' : 'isdo',
					'order_goods_type' : 'order_goods_type',
				}).then(res => {
					this.goods_status = res.data.goods_status
					this.sale_state = res.data.sale_state
					this.isdo = res.data.isdo
					this.order_goods_type = res.data.order_goods_type
				})
			},
			// 当页面滚动到底部事件被触发
			onReachBottom() {
				// 通知z-paging滚动到底部了，z-paging会进行相应的处理，例如加载更多数据
				this.$refs.paging.pageReachBottom();
			},
			// 下拉刷新被触发
			onRefresh() {
				// 告知z-paging下拉刷新结束，这样才可以开始下一次的下拉刷新
				setTimeout(() => {
					this.$tools.toast('刷新成功～')
				}, 500)
			},
			// @query所绑定的方法不要自己调用！！需要刷新列表数据时，只需要调用this.$refs.paging.reload()即可
			getList(pageNum, pageSize) {
				index.goodsSaleList({
					pageNum,
					pageSize,
					projectNo: this.searchValue,
					model: this.searchValue1,
					orderByColumn: 'sort',
					isAsc: 'asc'
				}).then(res=>{
					this.$refs.paging.complete(res.rows);
				})
			},
			// 搜索条件 清除 查询
			search(res) {
				this.$refs.paging.reload()
			},
			clear(res) {
				this.searchValue = ''
				this.$refs.paging.reload()
			},
			cancel() {
				this.searchValue = ''
				this.$refs.paging.reload()
			},
			clear1(res) {
				this.searchValue1 = ''
				this.$refs.paging.reload()
			},
			cancel1(res) {
				this.searchValue1 = ''
				this.$refs.paging.reload()
			},
		}
	}
</script>

<style scoped lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding-left: 20rpx;
		padding-right: 20rpx;
	
		.table-box {
			width: 750rpx;
			position: sticky;
			top: 0;
			z-index: 2;
			background: #ffffff;
			display: flex;
			justify-content: space-around;
	
			.table {
				padding: 23rpx 0;
				font-size: 28rpx;
				font-weight: 400;
				color: #666666;
				display: flex;
				flex-direction: column;
				align-items: center;
	
				.border {
					margin-top: 10rpx;
					width: 32rpx;
					height: 4rpx;
				}
			}
	
			.tableChange {
				padding: 23rpx 0;
				font-size: 28rpx;
				font-weight: 400;
				color: #333333;
				display: flex;
				flex-direction: column;
				align-items: center;
	
				.border {
					margin-top: 10rpx;
					width: 32rpx;
					height: 4rpx;
					background: #8295BC;
				}
			}
		}
	
		.search-box {
			width: 750rpx;
			height: 103rpx;
			background: #FFFFFF;
			z-index: 99;
			display: flex;
			align-items: center;
			.search-left-box {
				width: 50%;
			}
			.search-right-box {
				width: 45%;
			}
		}
	
		.list-box {
			padding-left: 20rpx;
			padding-right: 20rpx;
			margin-top: 20rpx;
			border-radius: 8rpx;
			background: #FFF;
	
			.top-box {
				display: flex;
				align-items: center;
				padding: 20rpx 0rpx;
	
				.tiem-box {
					color: #999;
					font-size: 24rpx;
				}
	
				.status-box {
					margin-left: auto;
					display: flex;
					align-items: center;
	
					.item-box {
						padding: 4rpx 12rpx;
						height: 42rpx;
						border-radius: 10rpx;
						background: #F5F7FB;
						color: #8295BC;
						font-size: 24rpx;
					}
				}
			}
	
			.xian {
				width: 662rpx;
				border-bottom: 1px solid #EAEAEA;
			}
	
			.title-box {
				padding-top: 10rpx;
				padding-bottom: 10rpx;
				color: #333;
				font-size: 28rpx;
				font-weight: bold;
			}
	
			.info-box {
				display: flex;
				align-items: center;
				border-radius: 8rpx;
				background: #F5F7FB;
				padding-top: 10rpx;
				padding-bottom: 10rpx;
	
				.info-item {
					flex: 1;
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
	
					.info-item-title {
						color: #999;
						font-size: 24rpx;
					}
	
					.info-item-text {
						margin-top: 8rpx;
						color: #333;
						font-size: 28rpx;
						font-weight: bold;
					}
				}
			}
	
			.text-box {
				padding-top: 10rpx;
				padding-bottom: 10rpx;
				color: #999;
				font-size: 24rpx;
			}
	
			.bnt-box {
				padding-top: 20rpx;
				padding-bottom: 20rpx;
	
				.bnt-big-box {
					display: flex;
					justify-content: flex-end;
					align-items: center;
	
					.bnt {
						margin-right: 20rpx;
						display: flex;
						align-items: center;
						border-radius: 10rpx;
						background: #F5F7FB;
						padding: 15rpx 30rpx 15rpx 30rpx;
						color: #4D8987;
						font-size: 24rpx;
					}
	
					.bnt1 {
						margin-right: 20rpx;
						display: flex;
						align-items: center;
						border-radius: 10rpx;
						background: #4D8987;
						padding: 15rpx 30rpx 15rpx 30rpx;
						color: #ffffff;
						font-size: 24rpx;
					}
				}
			}
		}
	}
</style>